package com.example.mapper;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.example.pojo.chineseTripPojo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface chineseTripMapp {

    // 插入一行数据到表中
    @DS("newMscLowCodeTest")  // 可以根据实际数据库切换不同的数据源
    @Insert("insert into ddm_chinese_trip(" +
            "number, create_time, update_time, creator, process_status, sys_update_user, sys_audit_user, sys_audit_time, sys_deleted, " +
            "name, department, section, gender, fare, passportNumber, business, busineseBegan, " +
            "enterRussiaOne, leftRussiaOne, enterRussiaTwo, leftRussiaTwo, " +
            "enterRussiaThree, leftRussiaThree, enterRussiaFour, leftRussiaFour, " +
            "flightNumber, phoneNumber, roomNumber, cancel,birthDate) " +
            "VALUES (" +
            "#{number}, #{create_time}, #{update_time}, #{creator}, #{process_status}, #{sys_update_user}, #{sys_audit_user}, #{sys_audit_time}, #{sys_deleted}, " +
            "#{name}, #{department}, #{section}, #{gender}, #{fare}, #{passportNumber}, #{business}, #{busineseBegan}, " +
            "#{enterRussiaOne}, #{leftRussiaOne}, #{enterRussiaTwo}, #{leftRussiaTwo}, " +
            "#{enterRussiaThree}, #{leftRussiaThree}, #{enterRussiaFour}, #{leftRussiaFour},"+
          "#{flightNumber}, #{phoneNumber}, #{roomNumber}, #{cancel}, #{birthDate})")



    void insertOne(chineseTripPojo chineseTripPojo);

    // 更新某个字段的值

    // 查询所有数据
    @DS("newMscLowCodeTest")
    @Select("Select * from ddm_chinese_trip where sys_deleted=0")
    List<chineseTripPojo> queryAll();

    // 根据编号编辑某一行数据
    @DS("newMscLowCodeTest")  // 数据源
    @Update("UPDATE ddm_chinese_trip SET " +
            "flightNumber = #{flightNumber}, " +
            "phoneNumber = #{phoneNumber}, " +
            "roomNumber = #{roomNumber}, " +
            "cancel = #{cancel}, " +
            "birthDate = #{birthDate}, " +
            "update_time = #{update_time}, " +
            "name = #{name}, " +
            "department = #{department}, " +
            "section = #{section}, " +
            "gender = #{gender}, " +
            "fare = #{fare}, " +
            "passportNumber = #{passportNumber}, " +
            "business = #{business}, " +
            "busineseBegan = #{busineseBegan}, " +
            "enterRussiaOne = #{enterRussiaOne}, " +
            "leftRussiaOne = #{leftRussiaOne}, " +
            "enterRussiaTwo = #{enterRussiaTwo}, " +
            "leftRussiaTwo = #{leftRussiaTwo}, " +
            "enterRussiaThree = #{enterRussiaThree}, " +
            "leftRussiaThree = #{leftRussiaThree}, " +
            "enterRussiaFour = #{enterRussiaFour}, " +
            "leftRussiaFour = #{leftRussiaFour}, " +
            "process_status = #{process_status}, " +
            "sys_update_user = #{sys_update_user}, " +
            "sys_audit_user = #{sys_audit_user}, " +
            "sys_audit_time = #{sys_audit_time}, " +
            "sys_deleted = #{sys_deleted} " +
            "WHERE number = #{number} AND sys_deleted = 0")
    void updateChineseTrip(chineseTripPojo chineseTripPojo);


}
